package app.texas.com.devilfishhouse.View.Fragment.home.didi;

import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.universal_library.fragment.BaseFragment;

import app.texas.com.devilfishhouse.R;
import app.texas.com.devilfishhouse.myUtils.WLogger;
import app.texas.com.devilfishhouse.ui.SimpleBackPage;
import app.texas.com.devilfishhouse.ui.UiHelper;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by solin on 2018/7/23.
 * 滴滴房产
 */

public class DiDiFragment extends BaseFragment implements View.OnClickListener {
    @BindView(R.id.et_housename)
    EditText et_housename;

    @BindView(R.id.ll_houseLocation)
    LinearLayout ll_houseLocation;

    @BindView(R.id.et_huxing)
    EditText et_huxing;

    @BindView(R.id.et_minaji)
    EditText et_minaji;

    @BindView(R.id.et_housePrice)
    EditText et_housePrice;

    @BindView(R.id.et_beizhu)
    EditText et_beizhu;

    @BindView(R.id.bt_submit)
    Button bt_submit;

    @BindView(R.id.rl_select_sale)
    RelativeLayout rl_select_sale;

    @BindView(R.id.rl_select_buy)
    RelativeLayout rl_select_buy;

    @BindView(R.id.iv_sale)
    ImageView iv_sale;

    @BindView(R.id.iv_buy)
    ImageView iv_buy;

    private boolean isBuy = true;

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_didi;
    }

    @Override
    protected void initView(View view) {
        ButterKnife.bind(this, view);
    }

    @Override
    protected void initData() {

    }

    @OnClick({R.id.ll_houseLocation, R.id.bt_submit, R.id.rl_select_buy, R.id.rl_select_sale})
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ll_houseLocation:
                UiHelper.shoSimpleBack(mContext, SimpleBackPage.SELECTLOCATION, null);
                break;
            case R.id.bt_submit:
                break;
            case R.id.rl_select_buy:
                if (!isBuy) {
                    rl_select_sale.setBackground(getResources().getDrawable(R.drawable.didi_select_false));
                    iv_sale.setImageResource(R.mipmap.didi_select_false);
                    rl_select_buy.setBackground(getResources().getDrawable(R.drawable.didi_select_true));
                    iv_buy.setImageResource(R.mipmap.didi_select_true);
                    isBuy = true;
                }
                break;
            case R.id.rl_select_sale:
                if (isBuy) {
                    rl_select_buy.setBackground(getResources().getDrawable(R.drawable.didi_select_false));
                    iv_buy.setImageResource(R.mipmap.didi_select_false);
                    rl_select_sale.setBackground(getResources().getDrawable(R.drawable.didi_select_true));
                    iv_sale.setImageResource(R.mipmap.didi_select_true);
                    isBuy = false;
                }
                break;
        }
    }
}
